<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos  -->
			<title>Docs For Class Rho_DB</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
						<script src="../media/lib/classTree.js"></script>
												<script language="javascript" type="text/javascript">
				var imgPlus = new Image();
				var imgMinus = new Image();
				imgPlus.src = "../media/images/plus.png";
				imgMinus.src = "../media/images/minus.png";
				
				function showNode(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
							var oImg = document.layers["img" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
							var oImg = document.all["img" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
							var oImg = document.getElementById("img" + Node);
									break;
							}
					oImg.src = imgMinus.src;
					oTable.style.display = "block";
				}
				
				function hideNode(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
							var oImg = document.layers["img" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
							var oImg = document.all["img" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
							var oImg = document.getElementById("img" + Node);
									break;
							}
					oImg.src = imgPlus.src;
					oTable.style.display = "none";
				}
				
				function nodeIsVisible(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
									break;
							}
					return (oTable && oTable.style.display == "block");
				}
				
				function toggleNodeVisibility(Node){
					if (nodeIsVisible(Node)){
						hideNode(Node);
					}else{
						showNode(Node);
					}
				}
			</script>
					</head>
		<body>
			<div class="page-body">			
<h2 class="class-name"><img src="../media/images/Class_logo.png"
														alt=" Class"
														title=" Class"
														style="vertical-align: middle"> Rho_DB</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
															<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
						
											<a href="#sec-const-summary">Constants</a> (<a href="#sec-consts">details</a>)
						
			</div>
	<div class="info-box-body">
        		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Thin Database abstraction class.</p>
<p class="description"><p>Normally Rho_DB is used by a DB_Model class, and not directly by a controller.</p><p>Important is that:  The database is set to use UTF-8 encoding.  All Times and dates are stored as GMT.  Field and table names should be lowercase, without spaces or other symbols ( _ is ok though )</p><p>Note that Rho_DB does not attempt to rewrite SQL statements to the database server's  particular dialect - that would require a heavy weight abstraction layer such as ADODB.  If you change database server types, you may have to rewrite the SQL statements (but not the function calls).</p><p>That said, it will standardise date and time values (ISO 8601 format),  and provides server-specific name and string escaping.  If you keep to standard SQL, you'll have fewer problems.  For example, avoid vender-specific functions such as mySQL's NOW() -  instead use <div class="src-code"><ol><li><div class="src-line"><span class="src-var">$now</span>=<span class="src-var">$db</span><span class="src-sym">-&gt;</span><a href="../Rho/Rho_DB.html#methodesc">esc</a><span class="src-sym">(</span><span class="src-id"><a href="../Rho/Rho.html">Rho</a></span><span class="src-sym">::</span><a href="../Rho/Rho.html#methodnowDate">nowDate</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">,&nbsp;</span><span class="src-id"><a href="../Rho/Rho_DB.html">Rho_DB</a></span><span class="src-sym">::</span><span class="src-id">DATE</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
</ol></div></p></p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho-database/DB_Model.html">DB_Model</a></li>
				<li><span class="field">final:</span> </li>
			</ul>
		<p class="notes">
			Located in <a class="field" href="_rho---db.inc.php.html">/rho/db.inc.php</a> (line <span class="field">66</span>)
		</p>
		
				
		<pre></pre>
	
			</div>
</div>


	<a name="sec-const-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Class Constant Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
						<span class="disabled">Constants</span> (<a href="#sec-consts">details</a>)
										| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
					</div>
		<div class="info-box-body">
			<div class="const-summary">
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#BIN" title="details" class="const-name">BIN</a> = 					<span class="var-type">256</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#BOOL" title="details" class="const-name">BOOL</a> = 					<span class="var-type">1024</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#CROSS" title="details" class="const-name">CROSS</a> = 					<span class="var-type">16</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#DATE" title="details" class="const-name">DATE</a> = 					<span class="var-type">32</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#DATETIME" title="details" class="const-name">DATETIME</a> = 					<span class="var-type">128</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#FIELD" title="details" class="const-name">FIELD</a> = 					<span class="var-type">0</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#FLOAT" title="details" class="const-name">FLOAT</a> = 					<span class="var-type">16</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#FULL_OUTER" title="details" class="const-name">FULL_OUTER</a> = 					<span class="var-type">8</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#INNER" title="details" class="const-name">INNER</a> = 					<span class="var-type">1</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#INT" title="details" class="const-name">INT</a> = 					<span class="var-type">8</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#LEFT" title="details" class="const-name">LEFT</a> = 					<span class="var-type">2</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#RAW_STR" title="details" class="const-name">RAW_STR</a> = 					<span class="var-type">4</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#RIGHT" title="details" class="const-name">RIGHT</a> = 					<span class="var-type">4</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#STR" title="details" class="const-name">STR</a> = 					<span class="var-type">1</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#TEXT" title="details" class="const-name">TEXT</a> = 					<span class="var-type">3</span>

				</div>
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#TIME" title="details" class="const-name">TIME</a> = 					<span class="var-type">64</span>

				</div>
							</div>
		</div>
	</div>


	<a name="sec-method-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Method Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
															<a href="#sec-const-summary">Constants</a> (<a href="#sec-consts">details</a>)
							
									<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
		</div>
		<div class="info-box-body">			
			<div class="method-summary">
																																			
				<div class="method-definition">
					<img src="../media/images/StaticMethod.png" alt=" "/>
					static 						<span class="method-result">DB</span>
										<a href="#factory" title="details" class="method-name">&amp;factory</a>
											([<span class="var-type">string</span>&nbsp;<span class="var-name">$name</span> = <span class="var-default">'default'</span>])
									</div>
																																																																																			
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result"><a href="../Rho/Rho-database/DB_Rowset.html">DB_Rowset</a>|bool</span>
										<a href="#directSelect" title="details" class="method-name">directSelect</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">&$sql</span>, <span class="var-type"></span>&nbsp;<span class="var-name">&$field_defs</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$record_class</span> = <span class="var-default">'DB_Record'</span>])
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result"><a href="../Rho/Rho-database/Rho_DB_Driver.html">Rho_DB_Driver</a></span>
										<a href="#driver" title="details" class="method-name">&amp;driver</a>
										()
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">string</span>
										<a href="#esc" title="details" class="method-name">esc</a>
											(<span class="var-type">string|int|bool</span>&nbsp;<span class="var-name">$value</span>, <span class="var-type"></span>&nbsp;<span class="var-name">$type</span>)
									</div>
																							
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">string</span>
										<a href="#field" title="details" class="method-name">field</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$fieldname</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$default_table</span> = <span class="var-default">''</span>])
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">string</span>
										<a href="#getName" title="details" class="method-name">getName</a>
										()
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">string</span>
										<a href="#getType" title="details" class="method-name">getType</a>
										()
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">string</span>
										<a href="#limit" title="details" class="method-name">limit</a>
											(<span class="var-type">int</span>&nbsp;<span class="var-name">$qty</span>, [<span class="var-type">int</span>&nbsp;<span class="var-name">$offset</span> = <span class="var-default">NULL</span>])
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">int|bool</span>
										<a href="#query" title="details" class="method-name">query</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">&$sql</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$table</span> = <span class="var-default">''</span>], [<span class="var-type">bool</span>&nbsp;<span class="var-name">$clear_cache</span> = <span class="var-default">TRUE</span>])
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">void</span>
										<a href="#select" title="details" class="method-name">select</a>
											(<span class="var-type"></span>&nbsp;<span class="var-name">&$sql</span>, <span class="var-type"></span>&nbsp;<span class="var-name">&$model</span>)
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">string</span>
										<a href="#table" title="details" class="method-name">table</a>
											(<span class="var-type"></span>&nbsp;<span class="var-name">$tablename</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$tbalename</span>)
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">string</span>
										<a href="#where" title="details" class="method-name">where</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$fieldname</span>, <span class="var-type">string|int|bool</span>&nbsp;<span class="var-name">$value</span>, <span class="var-type">int</span>&nbsp;<span class="var-name">$value_type</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$operator</span> = <span class="var-default">'='</span>], [<span class="var-type">string</span>&nbsp;<span class="var-name">$table</span> = <span class="var-default">''</span>])
									</div>
											</div>
		</div>
	</div>		

	
	<a name="sec-methods"></a>
	<div class="info-box">
		<div class="info-box-title">Methods</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
																		<a href="#sec-const-summary">Constants</a> (<a href="#sec-consts">details</a>)
							
										<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
						
		</div>
		<div class="info-box-body">
			<A NAME='method_detail'></A>
<a name="methodfactory" id="factory"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/StaticMethod.png" />
		<span class="method-title">static factory</span> (line <span class="line-number">150</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Produces an instance of the database class.</p>
	<ul class="tags">
				<li><span class="field">return:</span> A database instance.</li>
				<li><span class="field">final:</span> </li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		static <span class="method-result">DB</span>
		<span class="method-name">
			&amp;factory
		</span>
					([<span class="var-type">string</span>&nbsp;<span class="var-name">$name</span> = <span class="var-default">'default'</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$name</span><span class="var-description">: The name of the database connection settings from the config file to use - defaults to 'default'.</span>			</li>
				</ul>
		
			
	</div>
<a name="methoddirectSelect" id="directSelect"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">directSelect</span> (line <span class="line-number">239</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Execute a SQL SELECT query directly.</p>
<p class="description"><p>Not for general use - normally use a DB_Model object, which calls select() .</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> A database result object or FALSE.</li>
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodselect">Rho_DB::select()</a>, <a href="../Rho/Rho-database/DB_Model.html">DB_Model</a></li>
				<li><span class="field">throws:</span> Rho_Exception if there's a database error.</li>
				<li><span class="field">throws:</span> DB_Connection_Exception If there's a connection error.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result"><a href="../Rho/Rho-database/DB_Rowset.html">DB_Rowset</a>|bool</span>
		<span class="method-name">
			directSelect
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">&$sql</span>, <span class="var-type"></span>&nbsp;<span class="var-name">&$field_defs</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$record_class</span> = <span class="var-default">'DB_Record'</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">&$sql</span><span class="var-description">: A SQL statement that MUST have already been escaped (field names, strings, etc.).</span>			</li>
					<li>
				<span class="var-type">array</span>
				<span class="var-name">&$field_defs</span><span class="var-description">: An asssociative array of fields and their types.</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$record_class</span>			</li>
				</ul>
		
			
	</div>
<a name="methoddriver" id="driver"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">driver</span> (line <span class="line-number">266</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Returns the database driver instance being used.</p>
<p class="description"><p>Used internally by DB_Rowset.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The database driver for this database.</li>
				<li><span class="field">see:</span> <a href="../Rho/Rho-database/DB_Rowset.html">DB_Rowset</a></li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result"><a href="../Rho/Rho-database/Rho_DB_Driver.html">Rho_DB_Driver</a></span>
		<span class="method-name">
			&amp;driver
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodesc" id="esc"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">esc</span> (line <span class="line-number">318</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Escape a field value.</p>
<p class="description"><p>Example:  <div class="src-code"><ol><li><div class="src-line"><span class="src-var">$safe_string</span>=<span class="src-var">$db</span><span class="src-sym">-&gt;</span><a href="../Rho/Rho_DB.html#methodesc">esc</a><span class="src-sym">(</span><span class="src-str">&quot;Isn't&nbsp;it&nbsp;good?&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id"><a href="../Rho/Rho_DB.html">Rho_DB</a></span><span class="src-sym">::</span><span class="src-id">STR</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-comm">#returns&nbsp;something&nbsp;like&nbsp;'Isn\'t&nbsp;it&nbsp;good?'</span></div></li>
</ol></div></p><p>Note that string values (and dates, times, etc,)  should NOT be already enclosed by quotes - this will be done by this method as required.  This is WRONG:  <div class="src-code"><ol><li><div class="src-line"><span class="src-var">$wrong_string</span>=<span class="src-var">$db</span><span class="src-sym">-&gt;</span><a href="../Rho/Rho_DB.html#methodesc">esc</a><span class="src-sym">(</span><span class="src-str">&quot;'&quot;</span>.<span class="src-var">$my_string</span>.<span class="src-str">&quot;'&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id"><a href="../Rho/Rho_DB.html">Rho_DB</a></span><span class="src-sym">::</span><span class="src-id">STR</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-comm">#&nbsp;will&nbsp;return&nbsp;something&nbsp;like&nbsp;'\'my&nbsp;string\''</span></div></li>
</ol></div></p><p>May require an active database connection - will attempt to connect if this is the case.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The escaped value.</li>
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodfield">Rho_DB::field()</a>, <a href="../Rho/Rho_DB.html#methodtable">Rho_DB::table()</a></li>
				<li><span class="field">throws:</span> Rho_Exception if there's a database error.</li>
				<li><span class="field">throws:</span> DB_Connection_Exception If there's a connection error.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			esc
		</span>
					(<span class="var-type">string|int|bool</span>&nbsp;<span class="var-name">$value</span>, <span class="var-type"></span>&nbsp;<span class="var-name">$type</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string|int|bool</span>
				<span class="var-name">$value</span><span class="var-description">: the value to escape</span>			</li>
					<li>
				<span class="var-type">int</span>
				<span class="var-name">$type</span><span class="var-description">: The field type of the value to escape  Use the constants defined -  e.g. Rho_DB::STR .</span>			</li>
				</ul>
		
			
	</div>
<a name="methodfield" id="field"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">field</span> (line <span class="line-number">277</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Escapes a field name.</p>
	<ul class="tags">
				<li><span class="field">return:</span> The escaped field name. e.g.  `widgets`.`foo` .</li>
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a>, <a href="../Rho/Rho_DB.html#methodtable">Rho_DB::table()</a></li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			field
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$fieldname</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$default_table</span> = <span class="var-default">''</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$fieldname</span><span class="var-description">: The name of the field with or without the table name. e.g. 'foo' or 'widgets.foo'.  May be '*'.</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$default_table</span><span class="var-description">: The table name to use when $fieldname doesn't contain a table name.</span>			</li>
				</ul>
		
			
	</div>
<a name="methodgetName" id="getName"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">getName</span> (line <span class="line-number">195</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
	<ul class="tags">
				<li><span class="field">return:</span> The name of database instance - e.g. 'default'</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			getName
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodgetType" id="getType"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">getType</span> (line <span class="line-number">190</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
	<ul class="tags">
				<li><span class="field">return:</span> The type of database connection.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			getType
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodlimit" id="limit"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">limit</span> (line <span class="line-number">381</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Produce a driver specific LIMIT snippet for a SELECT statement.</p>
	<ul class="tags">
				<li><span class="field">return:</span> Something similar to LIMIT $offset, $qty</li>
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodwhere">Rho_DB::where()</a></li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			limit
		</span>
					(<span class="var-type">int</span>&nbsp;<span class="var-name">$qty</span>, [<span class="var-type">int</span>&nbsp;<span class="var-name">$offset</span> = <span class="var-default">NULL</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">int</span>
				<span class="var-name">$qty</span><span class="var-description">: Number of records to fetch.</span>			</li>
					<li>
				<span class="var-type">int</span>
				<span class="var-name">$offset</span><span class="var-description">: Starting at this row number, where the firt row is 0.</span>			</li>
				</ul>
		
			
	</div>
<a name="methodquery" id="query"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">query</span> (line <span class="line-number">219</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Execute a SQL query.</p>
<p class="description"><p>You MUST use the select() method instead for SELECT queries.</p><p>Normally this method is called by DB_Model class and not directly.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> Number of affected rows (which may be 0) or FALSE.</li>
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodselect">Rho_DB::select()</a>, <a href="../Rho/Rho-database/DB_Model.html">DB_Model</a>, <a href="../Rho/Rho_DB.html#methoddirectSelect">Rho_DB::directSelect()</a></li>
				<li><span class="field">throws:</span> Rho_Exception if there's a database error.</li>
				<li><span class="field">throws:</span> DB_Connection_Exception If there's a connection error.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">int|bool</span>
		<span class="method-name">
			query
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">&$sql</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$table</span> = <span class="var-default">''</span>], [<span class="var-type">bool</span>&nbsp;<span class="var-name">$clear_cache</span> = <span class="var-default">TRUE</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">&$sql</span><span class="var-description">: A SQL statement that MUST have already been escaped (field names, strings, etc.).</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$table</span><span class="var-description">: The table name this query effects.</span>			</li>
					<li>
				<span class="var-type">bool</span>
				<span class="var-name">$clear_cache</span><span class="var-description">: If the query is successful, should the cache for the table be cleared - default TRUE.</span>			</li>
				</ul>
		
			
	</div>
<a name="methodselect" id="select"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">select</span> (line <span class="line-number">252</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Execute a SQL SELECT from a model.</p>
	<ul class="tags">
				<li><span class="field">throws:</span> DB_Connection_Exception If there's a connection error.</li>
				<li><span class="field">throws:</span> Rho_Exception if there's a database error.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			select
		</span>
					(<span class="var-type"></span>&nbsp;<span class="var-name">&$sql</span>, <span class="var-type"></span>&nbsp;<span class="var-name">&$model</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">&$sql</span>			</li>
					<li>
				<span class="var-type"></span>
				<span class="var-name">&$model</span>			</li>
				</ul>
		
			
	</div>
<a name="methodtable" id="table"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">table</span> (line <span class="line-number">293</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Escape a table name.</p>
	<ul class="tags">
				<li><span class="field">return:</span> The escaped table name. E.g.  `widgets` .</li>
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodfield">Rho_DB::field()</a>, <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a></li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			table
		</span>
					(<span class="var-type"></span>&nbsp;<span class="var-name">$tablename</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$tbalename</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$tbalename</span><span class="var-description">: The name of the table to escape.</span>			</li>
					<li>
				<span class="var-type"></span>
				<span class="var-name">$tablename</span>			</li>
				</ul>
		
			
	</div>
<a name="methodwhere" id="where"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">where</span> (line <span class="line-number">363</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Produces an escaped SQL snippet for use in a WHERE statement.</p>
<p class="description"><p>Does not include the WHERE keyword, so you can combine snippets.  E.g.<div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-var">$sql</span>.=<span class="src-str">'WHERE'</span>.<span class="src-var">$db</span><span class="src-sym">-&gt;</span><a href="../Rho/Rho_DB.html#methodwhere">where</a><span class="src-sym">(</span><span class="src-str">'foo'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$bar</span><span class="src-sym">,&nbsp;</span><span class="src-id"><a href="../Rho/Rho_DB.html">Rho_DB</a></span>:<span class="src-id"><a href="../Rho/Rho_DB.html#constSTR">STR</a></span><span class="src-sym">,&nbsp;</span><span class="src-str">'widgets'</span><span class="src-sym">)</span>.<span class="src-str">'AND'</span>.<span class="src-var">$db</span><span class="src-sym">-&gt;</span><a href="../Rho/Rho_DB.html#methodwhere">where</a><span class="src-sym">(</span><span class="src-str">'qty'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'0'</span><span class="src-sym">,&nbsp;</span><span class="src-id"><a href="../Rho/Rho_DB.html">Rho_DB</a></span>:<span class="src-id"><a href="../Rho/Rho_DB.html#constINT">INT</a></span><span class="src-sym">,&nbsp;</span><span class="src-str">'&gt;'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-comm">#&nbsp;&nbsp;~&nbsp;'&nbsp;WHERE&nbsp;`widgets`.`foo`='beispiel'&nbsp;AND&nbsp;`qty`&gt;0&nbsp;'</span></div></li>
</ol></div></p><p>You can also use this method for generating JOIN statements.  E.g. <div class="src-code"><ol><li><div class="src-line">&nbsp;&nbsp;<span class="src-var">$sql&nbsp;</span>.=&nbsp;<span class="src-str">'LEFT&nbsp;JOIN&nbsp;'</span>.<span class="src-var">$db</span><span class="src-sym">-&gt;</span><a href="../Rho/Rho_DB.html#methodtable">table</a><span class="src-sym">(</span><span class="src-str">'foos'</span><span class="src-sym">)</span>.<span class="src-str">'&nbsp;ON'</span>.<span class="src-var">$db</span><span class="src-sym">-&gt;</span><a href="../Rho/Rho_DB.html#methodwhere">where</a><span class="src-sym">(</span><span class="src-str">'bar_id'</span><span class="src-sym">,</span><span class="src-str">'bars.foo'</span><span class="src-sym">,&nbsp;</span><span class="src-id"><a href="../Rho/Rho_DB.html">Rho_DB</a></span><span class="src-sym">::</span><span class="src-id">FIELD</span><span class="src-sym">,&nbsp;</span><span class="src-str">'foos'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-comm">#&nbsp;~&nbsp;'LEFT&nbsp;JOIN&nbsp;`foos`&nbsp;ON&nbsp;`foos`.`bar_id`=`bars`.`foo`</span></div></li>
</ol></div></p><p>May require an active database connection - will attempt to connect if this is the case.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> The escaped snippet NOT including the WHERE statement with a leading and a trailing space.  Something like: `table`.`field`='$value'</li>
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodtable">Rho_DB::table()</a>, <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a>, <a href="../Rho/Rho_DB.html#methodfield">Rho_DB::field()</a>, <a href="../Rho/Rho_DB.html#methodlimit">Rho_DB::limit()</a></li>
				<li><span class="field">throws:</span> Rho_Exception if there's a database error.</li>
				<li><span class="field">throws:</span> DB_Connection_Exception If there's a connection error.</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			where
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$fieldname</span>, <span class="var-type">string|int|bool</span>&nbsp;<span class="var-name">$value</span>, <span class="var-type">int</span>&nbsp;<span class="var-name">$value_type</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$operator</span> = <span class="var-default">'='</span>], [<span class="var-type">string</span>&nbsp;<span class="var-name">$table</span> = <span class="var-default">''</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$fieldname</span><span class="var-description">: The name of the field with or without the table name.</span>			</li>
					<li>
				<span class="var-type">string|int|bool</span>
				<span class="var-name">$value</span><span class="var-description">: the value to escape</span>			</li>
					<li>
				<span class="var-type">int</span>
				<span class="var-name">$value_type</span><span class="var-description">: The type of the value  Use the constants defined -  e.g. Rho_DB::STR .  When $value is a field name, pass Rho_DB::FIELD .</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$operator</span><span class="var-description">: The comparison operator, such as = , !=, &gt; , etc. Default is =</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$table</span><span class="var-description">: The table name to use when $fieldname doesn't contain a table name -  may be empty.</span>			</li>
				</ul>
		
			
	</div>
						
		</div>
	</div>

	<a name="sec-consts"></a>
	<div class="info-box">
		<div class="info-box-title">Class Constants</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
										<a href="#sec-var-summary">Constants</a> (<span class="disabled">details</span>)
						
			
										| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
					</div>
		<div class="info-box-body">
			<a name="constBIN" id="BIN"><!-- --></A>
<div class="oddrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">BIN</span>
			 = <span class="const-default">256</span>
			(line <span class="line-number">105</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating a binary field type.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a></li>
			</ul>
	
	
</div>
<a name="constBOOL" id="BOOL"><!-- --></A>
<div class="evenrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">BOOL</span>
			 = <span class="const-default">1024</span>
			(line <span class="line-number">109</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating an boolean field type.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a></li>
			</ul>
	
	
</div>
<a name="constCROSS" id="CROSS"><!-- --></A>
<div class="oddrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">CROSS</span>
			 = <span class="const-default">16</span>
			(line <span class="line-number">125</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating a CROSS JOIN.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho-database/DB_Model.html#var$joins">DB_Model::$joins</a></li>
			</ul>
	
	
</div>
<a name="constDATE" id="DATE"><!-- --></A>
<div class="evenrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">DATE</span>
			 = <span class="const-default">32</span>
			(line <span class="line-number">93</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating a date field type such as DATE.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a></li>
			</ul>
	
	
</div>
<a name="constDATETIME" id="DATETIME"><!-- --></A>
<div class="oddrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">DATETIME</span>
			 = <span class="const-default">128</span>
			(line <span class="line-number">101</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating a date time field type such as TIMESTAMP.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a></li>
			</ul>
	
	
</div>
<a name="constFIELD" id="FIELD"><!-- --></A>
<div class="evenrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">FIELD</span>
			 = <span class="const-default">0</span>
			(line <span class="line-number">70</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating a field.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodwhere">Rho_DB::where()</a></li>
			</ul>
	
	
</div>
<a name="constFLOAT" id="FLOAT"><!-- --></A>
<div class="oddrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">FLOAT</span>
			 = <span class="const-default">16</span>
			(line <span class="line-number">90</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating an floating point number field type such as FLOAT.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a></li>
			</ul>
	
	
</div>
<a name="constFULL_OUTER" id="FULL_OUTER"><!-- --></A>
<div class="evenrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">FULL_OUTER</span>
			 = <span class="const-default">8</span>
			(line <span class="line-number">122</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating a FULL OUTER JOIN.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho-database/DB_Model.html#var$joins">DB_Model::$joins</a></li>
			</ul>
	
	
</div>
<a name="constINNER" id="INNER"><!-- --></A>
<div class="oddrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">INNER</span>
			 = <span class="const-default">1</span>
			(line <span class="line-number">113</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating an INNER JOIN.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho-database/DB_Model.html#var$joins">DB_Model::$joins</a></li>
			</ul>
	
	
</div>
<a name="constINT" id="INT"><!-- --></A>
<div class="evenrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">INT</span>
			 = <span class="const-default">8</span>
			(line <span class="line-number">86</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating an integer field type such as INT.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a></li>
			</ul>
	
	
</div>
<a name="constLEFT" id="LEFT"><!-- --></A>
<div class="oddrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">LEFT</span>
			 = <span class="const-default">2</span>
			(line <span class="line-number">116</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating a LEFT JOIN.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho-database/DB_Model.html#var$joins">DB_Model::$joins</a></li>
			</ul>
	
	
</div>
<a name="constRAW_STR" id="RAW_STR"><!-- --></A>
<div class="evenrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">RAW_STR</span>
			 = <span class="const-default">4</span>
			(line <span class="line-number">82</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating a string field type that won't be converted by a model, such as VARCHAR or TEXT.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a></li>
			</ul>
	
	
</div>
<a name="constRIGHT" id="RIGHT"><!-- --></A>
<div class="oddrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">RIGHT</span>
			 = <span class="const-default">4</span>
			(line <span class="line-number">119</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating a RIGHT JOIN.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho-database/DB_Model.html#var$joins">DB_Model::$joins</a></li>
			</ul>
	
	
</div>
<a name="constSTR" id="STR"><!-- --></A>
<div class="evenrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">STR</span>
			 = <span class="const-default">1</span>
			(line <span class="line-number">74</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating a string field type such as VARCHAR.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a></li>
			</ul>
	
	
</div>
<a name="constTEXT" id="TEXT"><!-- --></A>
<div class="oddrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">TEXT</span>
			 = <span class="const-default">3</span>
			(line <span class="line-number">78</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating a text field type such as TEXT.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a></li>
			</ul>
	
	
</div>
<a name="constTIME" id="TIME"><!-- --></A>
<div class="evenrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">TIME</span>
			 = <span class="const-default">64</span>
			(line <span class="line-number">97</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Constant indicating a time field type such as TIME.</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../Rho/Rho_DB.html#methodesc">Rho_DB::esc()</a></li>
			</ul>
	
	
</div>
						
		</div>
	</div>
	
	<p class="notes" id="credit">
		Documentation generated on Tue, 13 Oct 2009 19:17:23 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.1</a>
	</p>
	</div></body>
</html>